{[{define "system/index/info.html"}]}
<html>
<head>
    <meta charset="utf-8">
    <title></title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <link rel="stylesheet" href="/static/layuimini/lib/layui-v2.5.5/css/layui.css" media="all">
    <link rel="stylesheet" href="/static/layuimini/css/public.css" media="all">
    <style>
        .layui-form-item .layui-input-company {width: auto;padding-right: 10px;line-height: 38px;}
    </style>
</head>
<body>
<div class="layuimini-container">
    <div class="layuimini-main">

        <div class="layui-form layuimini-form">

            <input type="hidden" name="id" value="{[{.item.Id}]}">

            <div class="layui-form-item">
                <label class="layui-form-label required">网站名称</label>
                <div class="layui-input-block">
                    <input type="text" name="sitename" lay-verify="required" lay-reqtext="网站域名不能为空" placeholder="请输入网站名称"  value="{[{.item.Sitename}]}" class="layui-input">
                    <tip>填写自己部署网站的名称。</tip>
                </div>
            </div>

            <div class="layui-form-item layui-form-text">
                <label class="layui-form-label required">logo</label>
                <div class="layui-input-block layuimini-upload">
                    <input name="logo" id="path_" class="layui-input layui-col-xs6" lay-verify="required" lay-reqtext="请上传文件" placeholder="请上传文件" value="{[{.item.Logo}]}">
                    <div class="layuimini-upload-btn">
                        <span><a class="layui-btn" data-upload="logo" data-upload-number="one" data-upload-exts="png|jpg|ico|jpeg"><i class="fa fa-upload"></i> 上传文件</a></span>
                        <span ><a class="layui-btn layui-btn-normal" id="chan_pic"><i class="fa fa-list"></i> 选择文件</a></span>
                    </div>
                </div>
            </div>

            <div class="layui-form-item layui-form-text">
                <label class="layui-form-label">META关键词</label>
                <div class="layui-input-block">
                    <textarea name="keywords" class="layui-textarea" placeholder="多个关键词用英文状态 , 号分割">{[{.item.Keywords}]}</textarea>
                </div>
            </div>
            <div class="layui-form-item layui-form-text">
                <label class="layui-form-label">META描述</label>
                <div class="layui-input-block">
                    <textarea name="descript" class="layui-textarea">{[{.item.Descript}]}</textarea>
                </div>
            </div>
            <div class="layui-form-item layui-form-text">
                <label class="layui-form-label required">版权信息</label>
                <div class="layui-input-block">
                    <textarea name="copyright" class="layui-textarea">{[{.item.Copyright}]}</textarea>
                </div>
            </div>
            <div class="layui-form-item">
                <div class="layui-input-block">
                    <button class="layui-btn layui-btn-normal" lay-submit lay-filter="setting">确认保存</button>
                </div>
            </div>
        </div>
    </div>
</div>
<script src="/static/layuimini/lib/layui-v2.5.5/layui.js" charset="utf-8"></script>
<script src="/static/layuimini/js/lay-config.js" charset="utf-8"></script>
<script>
    layui.use(['form','jquery','sh'], function () {
        var form = layui.form ,
            $ = layui.jquery,
            sh = layui.sh;
            sh.api.upload();

        //监听提交
        form.on('submit(setting)', function (data) {
            data = data.field;
            sh.request.post(
                {
                    url: '/system/index/info_ajax',
                    data: data,
                }, function (res) {
                    if (res.code == 200) {
                        sh.msg.success('修改成功', function () {
                            window.location.reload();
                        });
                    } else {
                        sh.msg.error(data.msg, {icon: 2});
                    }
                }
            );
            return false;
        });

        $('#chan_pic').click(function () {
            layer.open({
                title:"选择素材图片",
                type: 2,
                area: ["80%", "90%"],
                offset:'auto',
                maxmin : true,
                skin:'layui-layer-rim',
                shade: 0.5,
                content: "/system/upload/flist",
                success:function(){
                    setTimeout(function(){
                        layui.layer.tips('点击此处返回列表', '.layui-layer-setwin .layui-layer-close', {
                            tips: 3,time:1000
                        });
                    },500)
                },
                end:function () {
                    if (typeof(mFsUrls) != "undefined" && mFsUrls.length > 0) {
                        $("#path_").val(mFsUrls);
                        $(".path_").attr("src",mFsUrls);

                        var uploadName = "logo";
                        var urlString = mFsUrls;

                        $('#bing-' + uploadName).remove();
                        if (urlString.length > 0) {

                            var parant = $("#path_").parent('div');
                            var liHtml = '';
                            liHtml += '<li><a><img class="path_" src="' + urlString + '"  data-image></a><small class="uploads-delete-tip bg-red badge" data-upload-delete="' + uploadName + '" data-upload-url="' + urlString + '">×</small></li>\n';

                            parant.after('<ul id="bing-' + uploadName + '" class="layui-input-block layuimini-upload-show">\n' + liHtml + '</ul>');
                        }

                    }
                }
            });
            return false;
        });
    });
</script>
</body>
</html>
{[{end}]}
